Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a const ParamEnv when in default_method_body_is_const #92037

Merged
merged 1 commit into from
Dec 18, 2021

Conversation

fee1-dead
Copy link
Member

r? @oli-obk

This PR fixes the param_env function to return constness: Const correctly for trait methods marked with #[default_method_body_is_const]. The snippet below is erroneously accepted by the compiler and has been fixed by this change. (Playground)

#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]

trait Tr {}
impl Tr for () {}

const fn foo<T>() where T: ~const Tr {}

pub trait Foo {
    #[default_method_body_is_const]
    fn foo() {
        foo::<()>();
    }
}

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 17, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 17, 2021
@oli-obk
Copy link
Contributor

oli-obk commented Dec 17, 2021

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 17, 2021

📌 Commit a1f91aa has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 17, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 18, 2021
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#91566 (Apply path remapping to DW_AT_GNU_dwo_name when producing split DWARF)
 - rust-lang#91926 (Remove `in_band_lifetimes` from `rustc_metadata`)
 - rust-lang#91931 (Remove `in_band_lifetimes` from `rustc_codegen_llvm`)
 - rust-lang#92024 (rustc_codegen_llvm: Give each codegen unit a unique DWARF name on all platforms, not just Apple ones.)
 - rust-lang#92037 (Use a const ParamEnv when in default_method_body_is_const)
 - rust-lang#92047 (Set `RUST_BACKTRACE=0` when running location-detail tests)
 - rust-lang#92050 (Add a space and 2 grave accents )

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit cc043aa into rust-lang:master Dec 18, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 18, 2021
@fee1-dead fee1-dead added the F-const_trait_impl `#![feature(const_trait_impl)]` label Jul 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-const_trait_impl `#![feature(const_trait_impl)]` S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants